VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "LEmpleado"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
'---------------------------------------------------------------------------------------
' Module    : LEmpleado
' DateTime  : 30/11/2011 12:16
' Author    :
' Purpose   : Clase Logica Negocio Empleado
'---------------------------------------------------------------------------------------
Option Explicit
Dim dao As DAOEmpleado
Dim logDAO As DAOLog
Private Const MODULO As String = "EMPLEADO"

Private Sub Class_Initialize()
Set dao = New DAOEmpleado
Set logDAO = New DAOLog
End Sub

Public Function getLista(ByRef error As Integer) As Collection
Dim result As Collection
Set dao.Connection = utilConexion
Dim bempleado As New bempleado
bempleado.bEstado.ncodigo = UtilConstantes.ESTADO_EMPLEADO_ACTIVO
Set result = dao.getLista(bempleado)
If Not result Is Nothing Then
    Set getLista = result
Else
    capturarError UtilConstantes.STR_LISTAR
    error = UtilConstantes.OPT_ERROR_ENCONTRADO
End If

hnderr:
If Err.Number = 0 Then Exit Function
capturarError UtilConstantes.STR_LISTAR
End Function
Public Function getListaxCodigo(ByRef error As Integer) As Collection
Dim result As Collection
Set dao.Connection = utilConexion
Dim bempleado As New bempleado
bempleado.bEstado.ncodigo = UtilConstantes.ESTADO_EMPLEADO_ACTIVO
bempleado.ncodigo = error
Set result = dao.getListaxCambio(bempleado)
If Not result Is Nothing Then
    Set getListaxCodigo = result
Else
    capturarError UtilConstantes.STR_LISTAR
    error = UtilConstantes.OPT_ERROR_ENCONTRADO
End If

hnderr:
If Err.Number = 0 Then Exit Function
capturarError UtilConstantes.STR_LISTAR
End Function



Private Sub capturarError(opcion As String)
Set bLog.busuario = bparametro.bUsuarioActivo
bLog.sOpcion = opcion
bLog.sModulo = MODULO
If bConfiguracion.guardarHistorialSucesos Then
    Set logDAO.Connection = utilConexion
    logDAO.guardarNuevo bLog
End If
If bConfiguracion.enviarMailSuceso Then
    'TO DO
End If
Set bLog = Nothing
End Sub
Public Function login(ByRef bean As bempleado) As Integer
Dim bempleado As bempleado
Set dao.Connection = utilConexion

Set bempleado = dao.login(bean)
If bempleado Is Nothing Then
    login = UtilConstantes.OPT_LOGIN_CLAVE_INCORRECTA
    Exit Function
End If

'Set bparametro.bUsuarioActivo = busuario
login = UtilConstantes.OPT_LOGIN
End Function
